import {ElMessage} from "element-plus"

export function createMSG(message,type,plain ){
  return ElMessage({
    message,
    type,
    plain
  })
}
export function createMsg(message,type){
  return ElMessage({
    message,
    type
  })
}

export function getCurrentDateInfo() {
  const date = new Date();
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始，所以要加 1，并补零
  const day = String(date.getDay()).padStart(2, '0');
  const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  const weekDay = weekDays[date.getDay()];
  return {
    year: year,
    month: month,
    day: day,
    weekDay: weekDay
  };
}

export function getCurrentTime() {
  const date = new Date();
  const hours = String(date.getHours()).padStart(2, '0'); // 获取小时并补零
  const minutes = String(date.getMinutes()).padStart(2, '0'); // 获取分钟并补零
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 获取秒并补零
  return `${hours}:${minutes}:${seconds}`;
}

export function getLocalStorage(){
  return JSON.parse(localStorage.getItem('jzcyfh'))
}


export function generateRandomThreeDecimalPlaces(){
  return Math.random().toFixed(8);
}
